<!DOCTYPE html>
<html class="login-bg">
<head>
    <title>后台管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="css/bootstrap/bootstrap.css" th:href="@{css/bootstrap/bootstrap.css}" rel="stylesheet"/>
    <link href="css/bootstrap/bootstrap-responsive.css" th:href="@{css/bootstrap/bootstrap-responsive.css}" rel="stylesheet"/>
    <link href="css/bootstrap/bootstrap-overrides.css" th:href="@{css/bootstrap/bootstrap-overrides.css}" type="text/css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="css/layout.css" th:href="@{css/layout.css}"/>
    <link rel="stylesheet" type="text/css" href="css/elements.css" th:href="@{css/elements.css}"/>
    <link rel="stylesheet" type="text/css" href="css/icons.css" th:href="@{css/icons.css}"/>
    <link rel="stylesheet" type="text/css" href="css/lib/font-awesome.css" th:href="@{css/lib/font-awesome.css}"/>
    <link rel="stylesheet" href="css/compiled/signin.css" type="text/css" media="screen" th:href="@{css/compiled/signin.css}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>

<div class="row-fluid login-wrapper">
    <a href="index.html">
        <img class="logo" th:src="@{img/logo-white.png}"/>
    </a>

    <div class="span4 box">
        <div class="content-wrap">
            <h6>后台管理系统</h6>
            <form id="loginForm">
                <input class="span12" type="text" placeholder="用户名" name="username" required/>
                <input class="span12" type="password" placeholder="密码" name="password" required/>
                <button class="btn-glow primary login" id="login">登录</button>
            </form>
        </div>
    </div>
</div>

<!-- scripts -->
<script th:src="@{js/jquery-2.0.3.min.js}"></script>
<script th:src="@{js/bootstrap.min.js}"></script>
<script th:src="@{js/theme.js}"></script>
<script th:src="@{js/layer.js}"></script>
<script th:src="@{js/jquery.validate.min.js}"></script>
<script th:src="@{js/localization/messages_zh.min.js}"></script>

<script type="text/javascript">
    $('#login').on('click', function () {
        var subfrom = $('#loginForm');
        subfrom.validate({
            submitHandler: function (form) {
                var param = $(form).serialize();
                $.post('login', param, function (result) {
                    if (result.success) {
                        window.location.href = "index";
                    } else {
                        layer.msg(result.message, {icon: 5});
                    }
                }, 'json');
            }
        });
    });
</script>
</body>
</html>